package com.daqsoft.permission;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @author 周麟东 on 11:20
 */
public class ServletStorage {
    private static ThreadLocal<HttpServletRequest> REQUEST_LOCAL = new ThreadLocal<>();
    private static ThreadLocal<HttpServletResponse> RESPONSE_LOCAL = new ThreadLocal<>();

    public static HttpServletRequest getRequest() {
        return REQUEST_LOCAL.get();
    }
    public static void setRequest(HttpServletRequest request) {
        REQUEST_LOCAL.set(request);
    }
    public static HttpServletResponse getResponse() {
        return RESPONSE_LOCAL.get();
    }
    public static void setResponse(HttpServletResponse response) {
        RESPONSE_LOCAL.set(response);
    }
    public static HttpSession getSession() {
        return REQUEST_LOCAL.get().getSession();
    }
}
